﻿function ValidateFoodType() {
	var name = document.getElementsByName("FoodType_Name").item(0);
	if (name.value == "") {
		alert("Please input Name");
		return false;
	}
	return true;
}


function ValidateMenu() {
	var name = document.getElementsByName("Menu_Name").item(0);
	if (name.value == "") {
		alert("Please input Name");
		return false;
	}
	return true;
}


function ValidateInformationWeb() {
	var email = document.getElementsByName("InformationWeb_Email").item(0);
	if (email.value == "") {
		alert("Please input Email");
		return false;
	}
	var passemail = document.getElementsByName("InformationWeb_PassEmail").item(0);
	if (passemail.value == "") {
		alert("Please input PassEmail");
		return false;
    }
    var confirmPassemail = document.getElementsByName("InformationWeb_ConfirmPassEmail").item(0);
    if (confirmPassemail.value == "") {
        alert("Please input Confirm Passemail");
        return false;
    }
    if (passemail.value != confirmPassemail.value) {
        alert("Password and confirm is not match");
        return false;
    }
	var address = document.getElementsByName("InformationWeb_Address").item(0);
	if (address.value == "") {
		alert("Please input Address");
		return false;
	}
	return true;
}

function ValidateRestaurant() {
	var name = document.getElementsByName("Restaurant_Name").item(0);
	if (name.value == "") {
		alert("Please input Name");
		return false;
	}
	return true;
}

function ValidateContact() {
	var email = document.getElementsByName("Contact_Email").item(0);
	if (email.value == "") {
		alert("Please input Email");
		return false;
	}
	var name = document.getElementsByName("Contact_Name").item(0);
	if (name.value == "") {
		alert("Please input Name");
		return false;
	}
	var subject = document.getElementsByName("Contact_Subject").item(0);
	if (subject.value == "") {
		alert("Please input Subject");
		return false;
	}
	var detail = document.getElementsByName("Contact_Detail").item(0);
	if (detail.value == "") {
		alert("Please input Detail");
		return false;
	}
	return true;
}


function ValidateReply() {
	var content = document.getElementsByName("Reply_Content").item(0);
	if (content.value == "") {
		alert("Please input Content");
		return false;
	}
	var userreply = document.getElementsByName("Reply_UserReply").item(0);
	if (userreply.value == "") {
		alert("Please input UserReply");
		return false;
	}
	return true;
}

function ValidateCity() {
	var name = document.getElementsByName("City_Name").item(0);
	if (name.value == "") {
		alert("Please input Name");
		return false;
	}
	return true;
}


function ValidateOrders() {
	var orderdate = document.getElementsByName("Orders_OrderDate").item(0);
	if (orderdate.value == "") {
		alert("Please input OrderDate");
		return false;
	}
	return true;
}


function ValidateDistrict() {
	var name = document.getElementsByName("District_Name").item(0);
	if (name.value == "") {
		alert("Please input Name");
		return false;
	}
	return true;
}

function ValidateRevenue() {
    var from = document.getElementsByName("Revenue_From").item(0);
    if (from.value == "") {
        alert("Please input from");
        return false;
    }
    var to = document.getElementsByName("Revenue_To").item(0);
    if (to.value == "") {
        alert("Please input from");
        return false;
    }
    return true;
}

function ValidateOrderDetail() {
	var quantity = document.getElementsByName("OrderDetail_Quantity").item(0);
	if (quantity.value == "") {
		alert("Please input Quantity");
		return false;
	}
	var price = document.getElementsByName("OrderDetail_Price").item(0);
	if (price.value == "") {
		alert("Please input Price");
		return false;
	}
	return true;
}


function ValidateUsers() {
	var username = document.getElementsByName("Users_UserName").item(0);
	if (username.value == "") {
		alert("Please input UserName");
		return false;
	}
	var password = document.getElementsByName("Users_Password").item(0);
	if (password.value == "") {
		alert("Please input Password");
		return false;
	}
	var email = document.getElementsByName("Users_Email").item(0);
	if (email.value == "") {
		alert("Please input Email");
		return false;
	}
	return true;
}

function ValidateRegister() {
    var username = document.getElementsByName("NguoiDung_UserName").item(0);
    if (username.value == "") {
        alert("Please input UserName");
        return false;
    }
    var password = document.getElementsByName("NguoiDung_Password").item(0);
    if (password.value == "") {
        alert("Please input Password");
        return false;
    }
    var confirmpassword = document.getElementsByName("NguoiDung_ConfirmPassword").item(0);
    if (confirmpassword.value == "") {
        alert("Please input ConfirmPassword");
        return false;
    }
    if (password.value != confirmpassword.value) {
        alert("ConfirmPassword must be same with Password ");
        return false;
    }

    var email = document.getElementsByName("NguoiDung_Email").item(0);
    if (email.value == "") {
        alert("Please input Email");
        return false;
    }
    var hoten = document.getElementsByName("NguoiDung_Name").item(0);
    if (hoten.value == "") {
        alert("Please input Name");
        return false;
    }
    var dienthoai = document.getElementsByName("NguoiDung_Phone").item(0);
    if (dienthoai.value == "") {
        alert("Please input Phone");
        return false;
    }
    var didong = document.getElementsByName("NguoiDung_Address").item(0);
    if (didong.value == "") {
        alert("Please input Address");
        return false;
    }
    return true;
}

function ValidateUpdateAccount() {
    var email = document.getElementsByName("NguoiDung_Email").item(0);
    if (email.value == "") {
        alert("Please input Email");
        return false;
    }
    var hoten = document.getElementsByName("NguoiDung_Name").item(0);
    if (hoten.value == "") {
        alert("Please input Name");
        return false;
    }
    var dienthoai = document.getElementsByName("NguoiDung_Phone").item(0);
    if (dienthoai.value == "") {
        alert("Please input Phone");
        return false;
    }
    var didong = document.getElementsByName("NguoiDung_Address").item(0);
    if (didong.value == "") {
        alert("Please input Address");
        return false;
    }
    return true;
}